//
//  SYRootTabbarController.m
//  SYPerfectDemo
//
//  Created by Lssyyy on 2018/4/26.
//  Copyright © 2018年 Lssyyy. All rights reserved.
//

#import "SYRootTabbarController.h"
#import "IndexVC.h"
#import "ClassifyVC.h"
#import "SYRootNaviController.h"
@interface SYRootTabbarController ()

@end

@implementation SYRootTabbarController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self makeTabbar];
}

- (void)makeTabbar{
    NSArray *vcClassNameArray = [NSArray arrayWithObjects:@"IndexVC",@"ClassifyVC", nil];
    NSArray *vcTitleArray = [NSArray arrayWithObjects:@"首页",@"分类", nil];
    NSMutableArray *vcArray = [NSMutableArray array];
    for (NSInteger i = 0 ; i < vcClassNameArray.count; i++) {
        UIViewController *vc = [[NSClassFromString(vcClassNameArray[i]) alloc]init];
        vc.title = vcTitleArray[i];
        vc.tabBarItem.title = vcTitleArray[i];
        vc.tabBarItem.image = [[UIImage imageNamed:[NSString stringWithFormat:@"tabbar_%@",vcClassNameArray[i]]]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];;
        vc.tabBarItem.selectedImage = [[UIImage imageNamed:[NSString stringWithFormat:@"tabbar_%@_Selected",vcClassNameArray[i]]]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
        [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:kBlackColor} forState:UIControlStateNormal];
        [vc.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName:kBlackColor} forState:UIControlStateSelected];
        SYRootNaviController *navi = [[SYRootNaviController alloc]initWithRootViewController:vc];
        [vcArray addObject:navi];
    }
    self.viewControllers = vcArray;
}


@end
